import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import java.sql.*;

public class SetUp extends HttpServlet
{
 public void service(HttpServletRequest req,HttpServletResponse resp) throws ServletException ,IOException
 {
  
try
{ 
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  Connection con =   DriverManager.getConnection("jdbc:odbc:psi","psi","psi");
  System.out.println("connection is created"+con);
  String empcode=req.getParameter("ecode");
 int procode=Integer.parseInt(req.getParameter("pcode").trim());
String ename=req.getParameter("desg");
String pname=req.getParameter("s1");
System.out.println("pname"+pname);
String act=req.getParameter("as");

String submit=req.getParameter("vittu");

Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
if(submit.equals("Save"))
  	{

  PreparedStatement pstmt2=con.prepareStatement("insert into setup  values(?,?,?,?,?)");
                System.out.println("preparestatment is created"+pstmt2);
    	pstmt2.setString(1,empcode);
    	pstmt2.setInt(2,procode);
                  pstmt2.setString(3,ename);
                  pstmt2.setString(4,pname);
                  pstmt2.setString(5,act);   	           
                 pstmt2.executeUpdate();

}   

resp.sendRedirect("login.htm");
}
catch(Exception e)
{
 e.printStackTrace();
 }
}
 }